package com.elastic.bean.es;



import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;


@Data
@Setting(settingPath = "/settings.json",shards = 3,replicas = 3)
@Document(indexName = "t_user")
public class EsUser implements Serializable {

    @Id
    private Integer id;

    @Field(type = FieldType.Text,analyzer = "html_text_analyzer",searchAnalyzer = "ik_smart")
    private String username;

    @Field(type = FieldType.Text,analyzer = "html_text_analyzer",searchAnalyzer = "ik_smart")
    private String password;

    @Field(type = FieldType.Integer)
    private Integer sex;

    @Field(type = FieldType.Integer)
    private Integer deleted;

    @Field(type = FieldType.Date, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime updateTime;

    @Field(type = FieldType.Date, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

    @Field(type = FieldType.Integer)
    private Integer version;

    @Field(type = FieldType.Nested)
    private List<EsAddress> addresses;

}
